<?php

namespace app\common\controller;

use app\BaseController;
use app\common\services\ApiJsonWebToken;
use think\App;

class ApiController extends BaseController
{
    public $params;
    public $userId;
    public $langType;


    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->params = $this->request->post();
        $token = $this->request->header('Authorization');
        $this->langType = $this->request->header('Content-Language');
        if (!empty($token)) {
            $tokenService = new ApiJsonWebToken();
            $tokenData = $tokenService->verifyToken($token);
            if($tokenData) {
                $this->userId = $tokenData['uuid'];
            }
        }


    }
}